//串口透传
//需要将USART support设置为Enable(no generic Serial)

//Serial1为调试串口
HardwareSerial Serial1(PA10, PA9);
//Serial2连接NB模块
HardwareSerial Serial2(PA3, PA2);

void setup() {
  Serial1.begin(9600);
  //NB模块默认波特率为9600bps
  Serial2.begin(9600);
}

void loop() {
  //将NB模块的输出透传到调试串口
  if (Serial2.available())
  {
    String s = Serial2.readString();
    s.trim();
    Serial1.println("> " + s);
  }

  //将调试串口的输入发送到NB模块
  if (Serial1.available())
  {
    String s = Serial1.readString();
    s.trim();
    Serial1.println("< " + s);
    Serial2.println(s);
  }
}
